﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GMS.MainClasses;
using GMS.ServiceFunctions.Data;

namespace GMS.GroupsMenu
{
    public partial class EditParameterValues : ChildForms
    {
        ReturnData MRF = new ReturnData();
        String sP, parameter, parmeterType, valuE;
        public String SP
        {
            get { return sP; }
            set { sP = value; }
        }
        public String Parameter
        {
            get { return parameter; }
            set { parameter = value; }
        }
        public String ParameterType
        {
            get { return parmeterType; }
            set { parmeterType = value; }
        }
        public String Value
        {
            get { return valuE; }
            set { valuE = value; }
        }
        Int32 idItem, idGroup;
        public Int32 IdItem
        {
            get { return idItem; }
            set { idItem = value; }
        }
        public Int32 IdGroup
        {
            get { return idGroup; }
            set { idGroup = value; }
        }
        public EditParameterValues()
        {
            InitializeComponent();

            StoredProcedures = new String[1];

            StoredProcedures[0] = "[EditParameterValue]";

        }

        private void EditParameterValues_Load(object sender, EventArgs e)
        {

            textBox1.Text = SP;
            textBox2.Text = Parameter;
            textBox3.Text = ParameterType;
            textBox4.Text = Value;
        }

        private void acceptButton1_Click(object sender, EventArgs e)
        {
            MRF.ExecuteSqlCommand(StoredProcedures[0] + " " + IdItem + "," + IdGroup + ",'" + SP + "','"+Parameter+ "','" + Value + "'", ConnectionString);
        }

        private void textBox4_Leave(object sender, EventArgs e)
        {
            Value = textBox4.Text.Trim();
        }
    }
}
